class Solution {
public:
    int minimumLevels(vector<int>& possible) {
        int left = 0, right = 0;
        for (auto i : possible)
            right += i == 1 ? 1 : -1;
        for (int i = 0; i < possible.size() - 1; i++)
        {
            int score = possible[i] == 1 ? 1 : -1;
            left += score;
            right -= score;
            if (left > right)
                return i + 1;
        }
        return -1;
    }
};